import React from 'react';
import { Routes, Route, Navigate } from 'react-router-dom';
import { ConfigProvider } from 'antd';
import zhCN from 'antd/lib/locale/zh_CN';

// 页面组件
import Layout from './components/Layout';
import Dashboard from './pages/Dashboard';
import TaskList from './pages/TaskList';
import TaskDetail from './pages/TaskDetail';
import TaskCreate from './pages/TaskCreate';
import ProxyIpList from './pages/ProxyIpList';
import ResultList from './pages/ResultList';
import ResultDetail from './pages/ResultDetail';
import RuleList from './pages/RuleList';
import RuleEdit from './pages/RuleEdit';
import Login from './pages/Login';
import NotFound from './pages/NotFound';

// 样式
import './App.css';

const App: React.FC = () => {
  return (
    <ConfigProvider locale={zhCN}>
      <Routes>
        <Route path="/login" element={<Login />} />
        <Route path="/" element={<Layout />}>
          <Route index element={<Navigate to="/dashboard" replace />} />
          <Route path="dashboard" element={<Dashboard />} />
          <Route path="tasks" element={<TaskList />} />
          <Route path="tasks/create" element={<TaskCreate />} />
          <Route path="tasks/:id" element={<TaskDetail />} />
          <Route path="proxies" element={<ProxyIpList />} />
          <Route path="results" element={<ResultList />} />
          <Route path="results/:id" element={<ResultDetail />} />
          <Route path="rules" element={<RuleList />} />
          <Route path="rules/edit/:id?" element={<RuleEdit />} />
        </Route>
        <Route path="*" element={<NotFound />} />
      </Routes>
    </ConfigProvider>
  );
};

export default App; 